using ll = long long;

const int mod = 998244353;
ll C[40][40];

struct Barrett {
  using u32 = unsigned int;
  using u64 = unsigned long long;
  using u128 = unsigned __int128_t;
  static constexpr u128 s = u128(1) << 96;

  Barrett(const u32 P) : p_(P), m_((s - 1) / P + 1){}

  u32 div(u64 v) const {
    return (v * m_) >> 96;
  }

  u32 operator()(u64 v) {
    return v - u64(div(v)) * p_;
  }

  u128 m_;
  u32 p_;
} brt(mod);

ll ksm(ll a, ll b) {
  ll ret = 1;
  while (b > 0) {
    if (b & 1) {
      ret = brt(ret * a);
    }
    a = brt(a * a);
    b >>= 1;
  }
  return ret;
}

void solve() {
  int n, K;
  cin >> n >> K;

  C[0][0] = 1;
  for (int i = 1; i <= K; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }

  string s;
  cin >> s;
  s = " " + s;
  
  ll inv2 = ksm(2, mod - 2), ans = 0;
  vector<vector<ll>> f(n + 1, vector<ll>(K + 1));
  vector<ll> p(n + 1);

  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      p[i] = 0;
    } else if (s[i] == '1') {
      p[i] = 1;
    } else {
      p[i] = inv2;
    }
  }

  for (int i = 1; i <= n; i++) {
    if (s[i] == '0') {
      continue;
    }
    for (int j = 0; j <= K; j++) {
      for (int p = 0; p <= j; p++) {
        f[i][j] = brt(f[i][j] + C[j][p] * f[i - 1][p]);
      }
      f[i][j] = brt((f[i][j] + 1) * p[i]);
    }
    ans = brt(ans + f[i][K]);
  }
  cout << ans;
}